<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f" %>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h" %>

<h:form rendered="#{currentUser.teacher}" >
	<h:panelGrid columns="3" columnClasses="labelText, normalText" >
		<h:outputText value="Poczatek" />
		<h:inputText value="#{eventBean.event.startDate}" id="startDate" required="true">
			<f:convertDateTime pattern="dd-MM-yyyy HH:mm" />
		</h:inputText>
		<h:message for="startDate" styleClass="errorMsg" />
		
		<h:outputText value="Koniec" />
		<h:inputText value="#{eventBean.event.endDate}" id="endtDate" required="true">
			<f:convertDateTime pattern="dd-MM-yyyy HH:mm" />
		</h:inputText>
		<h:message for="endtDate" styleClass="errorMsg" />
		
		<h:outputText value="Deadline" />
		<h:selectBooleanCheckbox value="#{eventBean.event.deadline}" />
		<h:outputText />
		
		<h:outputText value="Miejsce" />
		<h:inputText value="#{eventBean.event.place}" id="place" required="true"/>
		<h:message for="place" styleClass="errorMsg" />
		
		<h:outputText value="Opis" />
		<h:inputText value="#{eventBean.event.description}" />
	</h:panelGrid>
	<h:messages styleClass="errorMsg" />
	<h:commandButton value="Dodaj" action="#{eventBean.addEvent}" rendered="#{not eventBean.editMode}" />
	<h:commandButton value="Zapisz" action="#{eventBean.updateEvent}" rendered="#{eventBean.editMode}" />
	<h:commandButton value="Usun" action="#{eventBean.delete}"  rendered="#{eventBean.editMode}" />
	<h:commandButton value="Powrot" action="nav_event_list" immediate="true" />
</h:form>